package br.com.rhweb.controladores;

import java.io.Serializable;
import java.util.List;

import org.hibernate.Session;

import br.com.rhweb.dao.Dao;
import br.com.rhweb.dao.IDao;

public abstract class Controlador_Padrao implements Serializable{
	IDao<Object> repositorio_object;
	public Controlador_Padrao(Session s, Object object) {
		repositorio_object = new Dao<Object>(s, Object.class);
	}
	public void cadastar_object(Object object){
		repositorio_object.save(object);
	}
	public void atualizar_object(Object object){
		repositorio_object.update(object);
	}
	public void remover_object(Object object){
		repositorio_object.delete(object);
	}
	public Object procurar_object(String id){
		return repositorio_object.load(id);
	}
	public List<Object> listar_objects(){
		return repositorio_object.list();
	}
}
